﻿using System;
using System.Windows.Media;
using WickedFlame.Core.Shapes;
using WickedFlame.Core.Extensions;
using System.Xml;

namespace WickedFlame.Core.State
{
    [Serializable]
    public abstract class ShapeMemento
    {
        string _fill;
        string _stroke;
        double _strokeThickness;
        //Brush _fill;
        //Brush _stroke;
        //double _strokeThickness;

        public virtual void SaveProperties(VectorShape shape)
        {
            _fill = ((SolidColorBrush)shape.Fill).Color.ToARGBString();
            _stroke = ((SolidColorBrush)shape.Stroke).Color.ToARGBString();
            _strokeThickness = shape.StrokeThickness;
        }

        public virtual void ResetProperties(VectorShape shape)
        {
            var c = new Color();
            shape.Fill = new SolidColorBrush(c.FromString(_fill));
            shape.Stroke = new SolidColorBrush(c.FromString(_stroke));
            shape.StrokeThickness = _strokeThickness;
        }

        public abstract VectorShape GenerateShape();

        //public abstract XmlNode GenerateSvgNode(VectorShape shape);
    }
}
